﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Data;
using DocumentManagement.Models;
using System.Windows;

namespace DocumentManagement.ViewsModels
{
  public  class PrintPreviewDocumentInViewsModel : ViewsModelBase
    {
        private QSHCEntities1 _entityModels;
        public QSHCEntities1 EntityModels
        {
            get { return _entityModels; }
            set
            {
                if (_entityModels != value)
                {
                    _entityModels = value;
                    OnPropertyChanged("EntityModels");
                }
            }
        }
        private CreateSend _myPrintCreateSend;
        public CreateSend MyPrintCreateSend
        {
            get { return _myPrintCreateSend; }
            set
            {
                if (_myPrintCreateSend != value)
                {
                    _myPrintCreateSend = value;
                    OnPropertyChanged("MyPrintCreateSend");

                    if (MyPrintCreateSend != null)
                        MyCreateSendICV = CollectionViewSource.GetDefaultView(MyPrintCreateSend.CreateSendAttacheds.Where(p => p.Active == true));
                }
            }
        }
        private ICollectionView _myCreateSendICV;
        public ICollectionView MyCreateSendICV
        {
            get { return _myCreateSendICV; }
            set
            {
                if (_myCreateSendICV != value)
                {
                    _myCreateSendICV = value;
                    OnPropertyChanged("MyCreateSendICV");
                }
            }
        }
        private string _title;
        public string Title
        {
            get { return _title; }
            set
            {
                if (_title != value)
                {
                    _title = value;
                    OnPropertyChanged("Title");
                }
            }
        }
        private string _toPosition;
        public string ToPosition
        {
            get { return _toPosition; }
            set
            {
                if (_toPosition != value)
                {
                    _toPosition = value;
                    OnPropertyChanged("ToPosition");
                }
            }
        }
        //private string _referrence;
        //public string Referrence
        //{
        //    get { return _referrence; }
        //    set
        //    {
        //        if (_referrence != value)
        //        {
        //            _referrence = value;
        //            OnPropertyChanged("Referrence");
        //        }
        //    }
        //}
        private string _paragraph1;
        public string Paragraph1
        {
            get { return _paragraph1; }
            set
            {
                if (_paragraph1 != value)
                {
                    _paragraph1 = value;
                    OnPropertyChanged("Paragraph1");
                }
            }
        }
        private string _paragraph2;
        public string Paragraph2
        {
            get { return _paragraph2; }
            set
            {
                if (_paragraph2 != value)
                {
                    _paragraph2 = value;
                    OnPropertyChanged("Paragraph2");
                }
            }
        }
        private string _paragraph3;
        public string Paragraph3
        {
            get { return _paragraph3; }
            set
            {
                if (_paragraph3 != value)
                {
                    _paragraph3 = value;
                    OnPropertyChanged("Paragraph3");
                }
            }
        }


        public PrintPreviewDocumentInViewsModel()
        {
            if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                //EntityModels = new QSHCEntities1();
                //MyTitle = "ชื่อเรื่อง" + MyPrintCreateSend.Title;
            }
        }

        public void LoadData()
        {

            Title = "เรื่อง  " + MyPrintCreateSend.Title;
            ToPosition = "เรียน  " + MyPrintCreateSend.ToPosition;
            //Referrence = "อ้างถึง  " + MyPrintCreateSend.Reference;

            //Paragraph1 = "\t" + MyPrintCreateSend.Paragraph1;
            //Paragraph2 = "\t" + MyPrintCreateSend.Paragraph2;
            //Paragraph3 = "\t" + MyPrintCreateSend.Paragraph3;

        }
    
    }
}
